# -*- coding:utf-8 -*-
# 入口文件
#请在python2.7环境下运行，时间问题，没来的及调成3版本
def print_lol(the_list):
    the_slist = []
    for each_item in the_list:
         if isinstance(each_item,list):
             print_lol(each_item)
         else:
             the_slist.append(int(each_item))
    return the_slist

def the_repeater(the_rlist):
    the_rulist = []
    for index, iterm in enumerate(the_rlist):
        num = 0
        for the_rnumber in the_rulist:
            if iterm == the_rnumber:
                num = 1
        if num == 0:
            the_rulist.append(iterm)
    return the_rulist


def print_x(the_rlist,the_order):
    the_len=len(the_rlist)
    if the_order == 1 or the_order ==3:
        for i in range(0,the_len):
            for j in range(0,the_len):
                if the_rlist[i] < the_rlist[j]:
                    the_number = the_rlist[i]
                    the_rlist[i] = the_rlist[j]
                    the_rlist[j] = the_number
        if the_order == 1:
            print (the_rlist)
        elif the_order == 3:
            the_rulist = the_repeater(the_rlist)
            print (the_rulist)

    elif the_order == 2 or the_order ==4:
        for i in range(0, the_len):
            for j in range(0, the_len):
                if the_rlist[i] > the_rlist[j]:
                    the_number = the_rlist[i]
                    the_rlist[i] = the_rlist[j]
                    the_rlist[j] = the_number
        if the_order == 2:
            print (the_rlist)
        elif the_order == 4:
              the_rulist = the_repeater(the_rlist)
              print (the_rulist)



if __name__ == '__main__':
     the_list = input("请输入多个数字，以逗号隔开：")
     the_rlist=print_lol(the_list)
     print ("您输入的数字序列为：{}".format(the_rlist))
     the_order = input("正序输1，倒序输2,去重正序输3,去重倒序输4：")
     print_x(the_rlist,the_order)


